package com.uoss.applications.modules.foundation.biz.impl;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.uoss.applications.framework.dao.model.QueryModel;
import org.uoss.applications.framework.dao.model.ResultSetModel;
import org.uoss.applications.framework.exception.BIZException;
import org.uoss.applications.framework.exception.DAOException;

import com.uoss.applications.modules.foundation.biz.IAppBIZ;
import com.uoss.applications.modules.foundation.dao.IAppDAO;
import com.uoss.applications.modules.foundation.entities.TcApp;


@Service
@Transactional
public class AppBIZImpl implements IAppBIZ {
	
	@Resource
	private IAppDAO appDAO;

	public IAppDAO getAppDAO() {
		return appDAO;
	}

	public void setAppDAO(IAppDAO appDAO) {
		this.appDAO = appDAO;
	}

	public void addApp(TcApp app) throws BIZException {
		try {
			app.setRecDate(new Date());
			app.setAuditId("admin");
			this.getAppDAO().addApp(app);
		} 
		catch (DAOException e) {
			e.printStackTrace();
		}
	}

	public void deleteApp(TcApp app) throws BIZException {
		try {
			this.getAppDAO().deleteApp(app);
		} 
		catch (DAOException e) {
			e.printStackTrace();
		}
	}

	public ResultSetModel<TcApp> getAppResultSetByPaging(QueryModel query) throws BIZException {
		ResultSetModel<TcApp> result = null;
		try {
			result = this.getAppDAO().getAppResultSetByPaging(query);
		} 
		catch (DAOException e) {
			e.printStackTrace();
		}
		return result;
	}

	public void updateApp(TcApp app) throws BIZException {
		// TODO Auto-generated method stub
		
	}

}
